package com.ysd.twocrm.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ysd.twocrm.entity.Orders;
import com.ysd.twocrm.entity.Users;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

public interface OrdersMapper extends BaseMapper<Orders> {
    //根据id来修改当前的状态以及流水号
    @Update(value = "update orders set orderStatus=#{orderStatus} ,orderunique=#{orderunique},orderEnd=now() where orderId=#{orderId}")
    Integer updateOrdersStatusByOId(String orderId,String orderunique,Integer orderStatus);
    //根据订单id来查询用户信息
@Select(value = "select * from users where userid =(select userId from orders where orderid=#{orderId})")
    Users selectUsersByOrdersId(String orderId);
//查看当前游客是否已付款 0:已付款
    @Select(value = "select * from orders where userId=#{userId} and orderstatus=0")
    Orders selectOrdersByUserId(Integer userId);
}
